<?php
/**
 * Created by JetBrains PhpStorm.
 * User: guansong
 * Date: 17/2/21
 * Time: 上午10:05
 * To change this template use File | Settings | File Templates.
 */

namespace app\index\controller;


use think\Controller;
use think\Db;

class NewsType extends Controller {
    /**
     * 用于显示添加页面
     */
    public function add()
    {
       return view();
    }

    /**
     * 保存用户提交的数据
     */
    public function save()
    {
//        /index/NewsType/save?typename=222
        //1. 接受用户提交的类型名称
        $typename = $_REQUEST["typename"];
        //2. 将接受到的数据提交到数据库
        $data = ["name"=>$typename];
        Db::table("zy_newstype")->insert($data);
        //3. 判断执行结果
    }
}